package ngat.oss.scheduling.auctions;

/** Event class for announcing an auction.*/
public class CallForProposalsEvent extends AuctionEvent {
    
    /** The Auctioneer to reply to with bids.*/
    private Auctioneer auctioneer;

    /** Time when bids must be received by.*/
    private long deadline;

    /** The auction terms. 
     * ### These are temporarily set to represent a timeslot using a Long - 
     * ### the convention will be: terms = period length starting from TM.getTime()
     */
    private Object terms;

    /** Create a CallForProposalsEvent.
     * @param timeStamp  The time of the event.
     * @param auctionId  A unique ID for the auction.
     * @param auctioneer The Auctioneer to reply to with bids.
     * @param deadline   Time by when bids must be received.
     * @param terms      Terms of the auction (in what format?).
     */
    public CallForProposalsEvent(long       timeStamp, 
				 int        auctionId, 
				 Auctioneer auctioneer, 
				 long       deadline, 
				 Object     terms) {
	super(timeStamp, auctionId);
	this.auctioneer = auctioneer;
	this.deadline   = deadline;
	this.terms      = terms;
    }

    /** Returns a reference to the Auctioneer handling the auction.*/
    public Auctioneer getAuctioneer() { return auctioneer; }

    /** Returns the deadline for bids.*/
    public long getDeadline() { return deadline; }

    /** Returns the terms of the auction.*/
    public Object getTerms() { return terms; }

    /** Returns a readable representation of this AuctionEvent.*/
    public String toString() { 
	return super.toString()+":[CallForProposals, ReplyTo:"+auctioneer+", Deadline:"+deadline+", Terms:"+terms+"]";

	// e.g. AuctionEvent@1102293933:AX67B:[CallForProposals, ReplyTo:ABSE.AuctionHandler, Deadline:1102304500, Terms:XXX]
    }

}
